package com.heima.mapper;

import com.heima.pojo.Brand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface BrandMapper {
    @Select("select * from tb_brand")
    @ResultMap("BrandMap")
    List<Brand> getAll();

    @Insert("insert into " +
            "tb_brand(id, brand_name, company_name, ordered, description, status) " +
            "values (null,#{brandName},#{companyName},#{ordered},#{description},#{status})")
    @ResultMap("BrandMap")
    Integer addBrand(Brand brand);

    @Select("select * from tb_brand where id=#{id}")
    @ResultMap("BrandMap")
    Brand brandById(Integer id);

    Integer updateBrand(Brand brand);

    @Delete("delete from tb_brand where id=#{id}")
    Integer deleteBrand(Integer id);
}
